small optimisation/fix todo
Clean up dependency injection so environment is injected at the top level