Added Function and tested it