This works well. Added some protection from empty ids