Added features & fixed some bugs

Added features & fixed some bugs