Some modifications and fixes