put guard around right function