Updated for sdk 3+