cleanup and code format