Refactored to use with play