merged better-rest-api branch