Logic improvements

Resolves #17