Added first version of exception handling.