works for nice data set. untested for messy data