Add comments, improve docstrings, add more descriptive names and clean some unnecessary code