Major surgery ongoing...cc
ongoing clean up, added scheme window support.