huge changes (refactoring everywhere)