Implementing cmds, cleaning up code, fixing bugs.

Title says all.