Implementing karansFunction
Adding function code to karansFunction