working on issue #53

a bit of testing and debugging, but I think it's mostly ok.
needs more testing.
working issue #56

a bit of testing and debugging, but I think it's mostly ok.
needs more testing.