Improved exception handling

Improved exception handling
Added javadoc
Added logging
Externalization of variables