Fixes for packaging

- Add autoload cookies
- Don't create top-level variables by using `setq`: prefer `let`
- More concise code
- Remove unnecessary boilerplate