Improve uptime function