added some simple math in AppDelegate