Fixed #59. #60 is code complete but untested