moving where error handling happens?