`var msg;` not used in this scope? should be safe to remove