some functions

with some test cases