Refactor profile handling.

- Doesn't assume that you are using the cli anymore.
- Using a class in profiles.py feels like a good idea.
Use a default argument instead of a variable.