Refactored and added output adapter