changed parser algorithm