Backend code review and cosmetic fixes