Refactored functions and added history api
0.2.0