Added preliminary exception handling.