refactored a ton from the raw work from the day, could use a bit more