Fix syntax and functionality