better way to handle content-length