Clean-up and better documentation