added try/catch to ParseInt to handle NumberFormatException