merged common code, cleaned up includes.