converted to coffeescript, added support for data attribute options, refactored for enhanced performance and scalability