Migrated code to Matrix4