Implementation Finished but it still needs debugging because 
the results are somehow incostistent with what i had in mind.