Rewrite function does not have a final else clause

Added final else clause. Either return the value unmodified in the final else clause or throw a descriptive error as to why it is not allowed!