added key adjustement to code