Additonal functions and bug fixes