Optimize code in regard to code review

Small changes were made in the anonymous handler code to improve performance
and increase readability and unit test file names were renamed to have test as
a suffix as opposed to a prefix.