Address some performance concerns, clean up style