style
use error monad instead of exceptions