fixing syntax and some useless code