applied pull requests from original repo.