Tried reimplement some functions with STL