Started to fix a load of bugs.