refactored to use malloc only and CodeEntry struct has Code member
instead of Code pointer member