removed recursion from parse method