Some refactoring and preparations for gnome-shell