better exception catching, use or instead of if-else