Deflection angles moved into a function