this really needs testing.. struggling a little