Added some new verbose output statements and fixed the arctan bug introduced by using atan instead of atan2