Converted to typescript