Fixed known bugs, code cleanup, added server commands and a lot of other changes.