In all of our deeds God looks at the intention, whether we do it for His sake, or for the sake of some other intention.