Added further checks for invalid angles