Issue6

Solution to issue #6. Needs more testing before next release.