Simplify logic
Add tag support.

Closes #1.