Removed raw_input from functions. Separated write function.