Lots of debugging and fixing.
Needs some implementation by Mazzu.