working on hands algorithms