Optimization, bug fixing and reorganization