New template & some mysql functions