cleaned up error message and layout code