heavy code refactoring and project organization