Add externs and change type to double