this is a simplified algorithm