Refractor codes after reimporting database