Cleanup code, add appDelegate