Code cleanup and more informative messages.