Refactoring

Refactoring classes. Moved helper classes to separate files. Refactoring
methods.