Refactor infrastructure and platform to decouple them