code placement refactoring
tests