improved some stuff and added javadoc