works except some float errors
add function works except some float errors