Initial commit; this file holds 90% of the functs