Cleaned up program loop