First full working version with db script