Initial settings and callback funcitons