Commented out Peter's commands, added half-second buffer to beginning and end of flagging times.
Added leakages.