minor touch up, organize code