adding new function
addding Nacky's suggestions