Making code cleaner and more object oriented