maybe a better way but still need to modify and test