both function written