Refactored Spout code and updated test coverage for all major spout commands