Refactored classes to fit the backend and connect it properly to the server