Added testcases and made some mods