Table fix + a bit of opimization