updates for a couple of items

1) fixes for python 2 and 3 support at the same time
2) added function for reuse