Refactored for Rails asset pipeline