First working version. Yay!