Adding type checking would improve the code quality even more. It would probably take a moment to make sure the type checking passes though.