cleanup and sqlite stuff