added the main function, also modified the structure of the classes