Adding settings and fixing bugs