Refactors recording function
Refactors power function, separates commandsMap into a reusable object
Fixes some comments