Improve weekday formatting.
Some refactoring, add license header to files.