Refactored everything and some features implemented