changed demand function back to stable version