Working on flex counter and reading data