Fixed plenty of warnings and javadoc