handle relative reference (this keyword : ~)

detect cyclic references & some refactoring