Not 100% clean, but working it seems.
Committing bad code.