clean code and updated insert