Adding cache and a nice refactoring to make things looks great :)