added sub logic