Refactoring logic, adding interfaces and Power.cs