same as last. corrected the angle determination