Refactoring; added comments, api version, and better Swagger 1.2 compat.