added conditions for displaying mail and pics