Closes #26: correct defgroup declaration and tidy code