curry functions
an ugly curryN function
small cleanup
curryN a bit cleaner