Moved poisson code into seperate function
Added debug code and corrected error in reference solution generator