Added various sanity checks

Added checks and error messages for configuration mistakes. Be a little
more forgiving with blank lines or dashed lines at the bottom.