working version (not gdk yet)