merge up old pull request 5 and 9