Tweaked the UI state stuffs and added partial templates.