Need Improvement on this code