First working version

Got most features working in a console application.