Added ExpressionEngine version detection, code cleanup