finished adding exception handling