More refactoring. Updates to streamline the code.