Optimize some internal procedures