first functionality commit
Merged this funtion to maintain changes