add comments for each function
remove unused function