main logic
removed delay from power slave