Updating module to adhere to more recent best practices

changes include parameterizing, not using global variables, various style changes to better adhere to the style guide, etc