refactored out my old curmudgeon R in favor of Hadley's elegant solutions