Fix some bugs. GCD is working, others - dunno