add checking background and forground
finalized one
update