First fully functional version

Total refactoring, added missing parts