Refactored method/classes

Refactored various methods and classes.