finished first draft writing, simplified some functions