Switching to raw sql statements