Fixes for packaging

- Add autoload cookies
- Don't create top-level variables by using `setq`: prefer `let`
- More concise code
- Remove unnecessary boilerplate

In connection with https://github.com/milkypostman/melpa/pull/2050