first working prototype. Hope it's bug free now.