I couldn't come up with a function that didn't take a jillion arguments.  Each line does same thing, but with subtle differences.