New version after refactoring it.

Uploading a version after refactoring it. The project is now divided in different packages, the logic was separated and the useless code was deleted. Connections to the server were also centralized.