swc extractor for html, minor refactoring