Fixed out_of_range error
Begin setting up math