ffs functions
Commented out debug stuff