Did a lot of work on improving the code and added Brent's algorithm to the writeup

Brent's algorithm to be implemented in the code shortly.