extracted photo handling logics into photohandler class