Sam was attempting to study at his apartment.
Sam was able to study in peace while having a cup of coffee.
His family had come over and they decided to stay the night.
His family had come over but they left early.