Fixed most bugs, sql statements erroring with <EOF> for some reason
merge conflicts fixed