Several fixes + Command lib

Command lib won't work yet but can be used as an API to hook into