Modified the socket server to check for entities type more efficiently. Thanks Ivan