Further cleanup; improved "front end"