Adds function with detailed comments