Some changes.
Bugfixes. Works for now.