Added key check, small layout optimizations