Add abstractions to Document & Scope, simplify common functions usage, switch to tab indents in all files.