junyan's serial

junyan's serial implementation
get statistics in a separate function
latest code