Imported code for v2.2 of the app