Usefull code that can be helpful in writing different apps