separated image related code