Implemented angle calculation