Big changes
Implemented the basic logic