Refactor test code, much shorter/cleaner now