functions defined and cooments added