Cleaned up for review of https://sbforge.org/jira/browse/NAS-2394 .