Created common handler for prepare