Updated comments and function names.
Added functions.