use std::size_t for len