Minor non-functional improvements

- typos in javadoc
- add TODOs for potential problems
- remove casting where not needed