incorporated Ali's code
moved files for python import
standalone python module based on Ali's changes