Added allow_nil option