initial commit after some serious refactoring