Refactored inserting to db part. Hardcoded k = 1.