Implement new commands, bugfixes, cleanup

Signed-off-by: Andrew 'Necromant' Andrianov <andrew@ncrmnt.org>