Remove unnecessary code and add documentation.