Closes #158 and contribs to #156