Fixes #152, #151, #148