REFACTOR: Consolidated a few IO functions