Completely rewrite commands

along with some other changes