Completed function

Written function + example commands to execute it.