Refactor console application