Changes to key parsing algo