Minor optimizations; Renaming variables; Docstring corrections