Fixes #1, fixes #25, fixes #12, fixes #26