cleaned up if/else statements and fixed various syntax errors.