Changed api logic a bit