cleanup

Linted, styled, shortened long lines, added comments, separated out some functions, explicitly exposed functions.
This doesn't need another bump; 0.3 hasn't been released or merged yet.