Tons of edits and a couple of new functions