Added package and refactoring code