Went through all the code and updated it

I have cleaned up all the code and made it much neater, the API is
better and more... Basically, its a new version!