Working implementation of POW