consume function should now work properly