Fixed functions some more