fix for missing lines in side-by-side
cleaned up code and placed some in helper