Adding vars, writing function