Added correct calculation of angles