crude and incomplete implementation