trimmed the code