reformatted and removed unused code