Added caching
Fixed indentation and deleted trainling whitespaces