Added better scope validation. Closes #87.