adding exception catching