support for setOptions (#8), basepath (#9) and debug option (#12)