Ancient oceans, ice sheets and the hydrological cycle on Mars