added better error handling on missing arguments