added functions with comments