charges function works properly