Corrected Line Shellings code and separated line and direction choice from the function.