working for all examples