cool trick of using dot product - faster, eh?