Cleanup in the code

Remove extra headers and functions from the code to have cleaner files
since some of them are a bit messy.
Merge pull request #288 from vmg/cleanup

Cleanup in the code