adds selection pseudo class, cleans up code