Issue ITTE-458

Optimizing the code and adding javadoc comments.