Waf extension

A bunch of waf fixes and extensions, tested to some degree