format and cleanup code