improve enumerate method