adding exception handling