An acutal working version... still needs much work though