added scaling and fixed command line crashes