Added an EnvironmentRepository interface and made plugins use it (through API class)