Adding support for bind attribute

a good old fashioned if/else would be much more readable here