improved logging
fixed bug by setting currentitem in receive instead of end. renamed some variables for clarity. style improvements