Remove file writing from db function