Add OnDelivery flag for better accounting
Signed-off-by: JohnMave126 <johnmave126@gmail.com>
Refine code. Add comment and follow PEP8
Signed-off-by: JohnMave126 <johnmave126@gmail.com>