Remove duplicated code
Added double type to optimizeTypeOf
Merge pull request #444 from karakurihiden/typeof

Added double type to optimizeTypeOf
Merge pull request #432 from ovr/ext_fixes

Remove duplicated code