On Riemann's Theory of Algebraic Functions and their Integrals