refactorings

thanks sanshi0518