Premature optimization is the root of all evil, so you shouldn't worry about whether your code is the "best" way to solve the problem as long as you don't have an actual performance issue (lag, crashes etc). I've seen tons of people that spend too much time optimizing their code and then never finishes any of their projects...