Fixed key processing, added key decoding