order of these two fns presumably needs changing - getting an error