typos and code cleanup