Code changed to a working one.