this parsing can use a func of its own (also given that it's used twice)