addressing PR comments; refactoring specs; refactoring external dereferencing functionality