Implemented the main components, refactored and tested them