Refactoring of existing code and splitup into packages