project is underway with lots of trial and error for figuring it out. sw.c is old code that is only there for reference while reimplementing in new file