Various fixes
Import devflow code
Import devflow code byChristos Stavrakakis <cstavr@grnet.gr>,with minor modifications.