integer powers: streamlined and refactored