Adding scope support (almost done)