refactoring of Assignment-4's code done. some changes will be there in future if needed