refactor testing to make it cleaner