reformatting and code cleanup