changed first post with r code