made changes to add third argument functionality