Code cleanup (see comments on issue #56)