Code cleaning and enhancements

Enhancements, code clarity, encrypt-key starting position function
changed.