/ Cleaned up some code and added comments.
/ Updated sql script.