Added more javadocs, added a few TODOs and removed some duplicated code

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>