Put safeguards to polling algorithm
Finally fixed tedious relative import problems