Error handling and javadoc