detect obj and react accordingly