Adding check for function arg. Adding additional tests. Adding comment about copied code.