Modified and fixed some issues