Adjust code to appframework api