Another random improvements, features and fixes.

Unify functions
Make main() return exit code
Add version to user agent
Add tss@home manifest api as a fallback (mainly for older betas)
Add more checks
Make everything consistent
Other improvements