Closes #58. added tests