functions with comments and testing