Continued refectoring code.