Refactored parse_table