Moved test code out of main package