Fixed bug in CryptoNight calc + some cleanup