Fix the conditionals.
Add a docstring