Final version.

Deleted a bunch of printf's and unused functions