Fixes #194 #195 #196 and #198