finished calculate points and dry out some code