Cleaning up duplication and unecessary cursor usage.

Closes #34.