Various changes to clean up code and resolve warnings.