Added various functions

 * too lazy to list, look at the diff