Some fixing/optimising