Continued bringing over and cleaning up base code.