added some fixes and functionally