Resist the urge to hack your code to add new functionality. A hack is a tricky bit of programming judo which allows your program to perform some new action that was not anticipated when the program was initially written. Instead of hacking you should try to refactor.
Refactoring is the act of reorganizing your programs internal architecture without changing its external behavior. It is typically a technique of object oriented programming: moving methods or fields from one class to another. The emphasis is on making small, simple changes to your code which can be tested thoroughly
For more about refactoring: