Updated api and added javadoc