extracting executeCodeAt method