For this function, it's not clear what the arguments should be, and what the conditions for throwing an exception are. Can documentation be added to clarify?