updated code for better performance