Implemented all main logic of project