Split test code from main codes