replaced python scripting with bash magic