Moved some functions to an include file, added lane allocation to main algorithm