edoc fixes

Move -spec declarations to functions to make edoc happy, plus some incidental whitespace cleanups