refac - move functionaly from gui to w
draft cache
reset w state vars on loading file and restart gateway
purge
refac build function
refac build function
refac build function
refac build system