updated all scripts to use __init__ to off load some common logic to all files, fixed many bugs