Remove unnecessary code
Reduce max cyclomatic compexity to 12