making things prettier and more error checking