Optimization, fixes