More documentation and cleaned up useless code