Big ole refactor