improved comments and function names