refactors context properties parsing and setting

- correctly calculate the length of the storage array.
- ensure that in a given key,value pair value is sensible. Necessary because properties has an odd length.
- rework control flow.
- context properties should not start with a zero.