Changed parsing logic to use car and cdr