add some function docs, make a couple functions static