modified based on the disscussion

@pravsripad Please check it, thanks!