Added testmain to test functionality