refactored test code out of main src