made code efficient