some commenting done, needs to be worked upon with the latency setup