Improve Application.instances, use flatMap instead of map

This commit changes Application.instances to get rid of the unnecessary inner async and uses flatMap instead of map.