remove tab, format code, fix bug, add cache for expensive call