added try and catch with a e.printStackTrace()