function implemented with 90%