Added commenting to function f