adds exception handling