adding implementation for extracting code