Exceptions added.
ToDo: Replace the print statements by exceptions