Perpendicular angle calculation added.