Added check function, styles corrected, and error message added