Restructure testing code again