updated documentation to fix check errors, updated order of arguments in code to match documentation
code cleanup and updated order of arguments