Things got a bit messy...
------------------------------------------------------------------------------------------------------------------------------------------------
(still working on it)