refractoring code, only reduce at the moment
for some reason the parser isnt working