First implementation of outlier detection, also write the angles to a file after the process