changed gate function to gaussian