Moved test code to test file