move wpp code from main.cpp to wpp.cpp