(Apple) Refactor BTpad code