code re-formatting and cleanup