refactors line detection python code to use class-based member variables