added insert method
refactored it