some style changes and code cleanup