remove unused function
add more unit tests