move obs into separate function