Refactor container and command creation