parameters moved to separate function
factorial removed, NOSE factorial used