format and cleanup