Moved the code structures into a new file and fixed another zoom bug