Refactoring code for more reliable use.