Change coding structure and add settings page