#10: Moved enviroment-related detection to separate module, added method to override environment dynamically