No more seg fault on empty input and moved code to run()