refactor
added no type test, need to catch exception to make it pass