Added exception handling to form