Removing commented out code
Fixed some parsing and related logic errors