implement Detect

Closes #1.