Fixed error11, cleared old unused code