Masonry implemented thanks to @nanmeng