command abstraction and cleanup