changed insert and select statements