Feature scoping

Scoping almost done implementing. Only thing missing is functions.