Cleaning up the code somewhat.