working out some parsing logic