Fixed all the classes and started logic for main cycle