Non-functional code. Insert is not working properly