Make parser more generic