code sort of merged