Added simple command line interface and fixed bugs in Engine code