extracted parse method