Move sanitize logic to widget