added support for exception handling and added new parameter -h for displaying help.