Various code used for training purpose.