Including several testing code & algorism.