Updated with my own functions