“The reward of deeds depends upon the intentions and every person will get the reward according to what he has intended.” said the Messenger of Allah (s):Sahih Al Bukhari Book 1 Hadith 1.
——————————————————————————————————————————————–
Imam Bukhari started compiling the “Sahih Al Bukhari” in Mecca and wanted to only include the most authentic Ahadith in it.
Before recording EVERY hadith he would take a ghusl(bath), and perform Salat-ul-istikhara (salat for seeking guidance from Allah subhana hu ta’aala).

Think.
Why did Allah subhana hu ta’aala want this hadith to be the first one?
——————————————————————————————————————————————–
We make the “intention” for doing an action before actually doing it.
if the intention is to “please Allah subhana hu ta’aala” then the action we do, will have our best effort,accomplished the Prophetic way and without any riya (arrogance).

A Believer’s ultimate goal is to gain the Pleasure of Allah subhana hu ta,aala, in Every action he does.

So,check and correct your intention before doing any deed, specially ones done in public.
i checked and corrected mine before posting this.
May Allah subhana hu ta’aala help us always in checking and correcting our niyah and forgive us if we fail or forget ,ameen