Removed an unused function, cleaned up error messages a little.