small code refactor, small fix bugs, Javadocs :)