Changed function to encode alg to match the one in alg.cubing.net.js, reworked the API ad began to wrap it into a class