So, you want to remove those lines your code that makes your 500 line script span to 2000. Try this neat trick in Adobe Dreamweaver or any IDE that supports Regular Expression.
So, you want to create a Joomla Module? Here’s a few ways that you can do it. This post will help you get the best solution to create your new custom Joomla Module.