Fix bug; refactor; add convenience methods