general optimazition and code management