adding exception handing