refactor to use a safer MaybeAccount type where necessary