Added algorithmic comments and implemented some double-integrals