Huge refactor. Use when instead of q.
Update gitignore.