refactores template funciton unused promise