Add tests and update input parsing/validation for post. Fix some style per nanodeath's suggestions.