Added line numbers and re-factored a bit