added some working code, so people can test the base idea of it