Javadoc implemented. Refactors and optimizations made

Stable version, but some changes are need to be made still, to optimize
the code comprehention and update