Setup framework and implement some fucntions