broke sql parser into functions