Implement when macro