Small code clean-ups, fixed sql setup script