refactored codes & removed unnecessary tests