Refactor code

Refactor code, move CSS and JavaScript to the bottom of the script
for an easier overview of it.
Also, change the uptime calculations to be pure JS.
Add license header

Add a license header to the script.