Moved stack to use a deque rather than reimplement a stack
Changed Memory to IMemory and to only have two methods, read and write
moved template text from many classes