Added settings and code cleanup