Changed exception thrown to out_of_range, added sprint format function (Issue #6)