Follow-up to c7b5fbb

Cleanup and added function descriptions.