Updating app function for v4 and v5