Code cleanup and update of settings