Various best practices refactors