works for simple cases