Fix vars, beautify code