refactored packages and added tests