Fix and opimalisation