added better code