implementing function differently to avoid conflcts