completes basic code for Phase IV Part A, needs to be debugged