Moved test codes in better places