parsing and checking functions