changed to avoid unwanted recursive call that was causing stackoverflow