Adding snippet and fixing cursor issue