Added flags and some more error messages