I think it'd be a good idea to write tests for this function.