added settings page, modified code to use settings