Migrated the getController method from context to core, minor adjustments.