Implement `resolve` and use it accordingly

See #5.