Moved out parsing code into parsing package