i did a similar thing, but used 1/4 inch threaded rods inplace of the vertical 2×4’s. HD and other hardware stores sell nifty little threaded caps that have wings on it that can be directly screwed into the ceiling joists. i used an old door for the shelf.