Refactoring

Reorganizing the code into packages