Websql refactor