Fixed 2 bugs and implemented memory functionality.