a few renames for clarity and added an example unit test