Better len detection, context manager support