add documentations and test functions