added select, insert and update functions