Fixed some typos and changed order of functions to match instructions