second commit, fixed errors but still not functioning correctly