Fixes #36 Needs testing