better var names, further separation of processes from main loop