update for arbitrary x and y
Merge pull request #9 from zhenhu/master

update for arbitrary x and y