response codes refactor with init function