Added stripping of square brackets to cleanup_value