Add power level functionality; clean up some code.