fixed typos and cleaned up code