Planning with General Objective Functions: Going Beyond Total Rewards