Improving and updating SQL script

Fixes #28