cleaning up APNS code