added javadocs
added error handling