huge overhaul - still messy