3rd commit: updated code, minor corrections to functions names