minor performance updates and PEP8