Switched to a lot more flexible scope implementation.