final commit, fixed bugs by adding two variables