[Meta] Fixed some build warnings and did minor refactoring.