Added a test for #833.
Improved code readability.