Refactored out the consumer handler to allow more flexible code flow