Added command chaining and some cleanup