Implementation

Function definition and comments added