Updated with Soumik's version