Use suggestions from FP Complete
Further refactoring from FP Complete