Feature issue 22

Also fixes issue 49,56