Finished implementing the calculationy bits