Tryin to fix intensity function