added new way of discovering widget names and made the directive slimmer.