some reformatting plus removing old code that was commented out