Style overhaul and minor bug fixes