re-organizing the code (making proper objects)