Move tools into a distinct folder.
Add comments
Add comments.
Clean.
Correct function name: inser_id => insertid.