Add default constants, slightly better error handling