automating the creation of sidebar