Added basePath option and support for relative paths