Implementing solution to issue #35

See issue #35 for details.