Added cache limit for layouts, fixed some typo/bugs