low level refactoring