Added comments and upgrade the implementation of regression