basic refactoring and system