space-efficient methods