Improvement on data manipulations and unit test added