functionality copied over from iPhone version