filled in all main IO functions