clean-up and add docs stub

the reason it's one big chunk is that i changed indentation to match zack's style, sorry!
i replaced this ternary chain with an if/if else block to make it more clear what is going on