switching to Derrick's cleaner implementation