Restructure

This restructuring is needed to provide proper python package project. Please see the diffs for changes. No functional changes should be done, only restructuring related.
I've added in new patch statement to set variable if not.