Started adding self vars for a refactor

 of this ugly code. But it's a lot and I need to stop for now due to other obligations.