Added Unit Tests, updated Javadoc
Refactored code and updated unit tests