added scan code, edited code for Sum, WSum