added a lot of code from dev docs but did not get it working