Rewrote database schema