refactored testing logic out to own file