Re-arrange functions for robustness
Merge pull request #36 from cbwiedel/master

Attempt to solve tab problem