Added events per line option and bug fixes