refactored code. relocated files