revised spans and fixed bugs on sexp generation