Adding Linemanager functionality and did some refactoring