Fixed #9  merging code from local