Streamline selection code, and make it styleable via css