separated some codes like "api" from "stream"