More error checking cleanup