flip function moved from emapex to utils
refactored window module - additional doc, argument checks etc