Change types to more semantically-appropriate
Improve code documentation