Added memory locations and assignment. Bugfixes.