Refactoring and clean up of sample test code