Updated Backend

Made some backend changes. I created a class structure to make coding easier. I also revised some of the layout.