refactored everything into packages