added p59
replaced hashes with sets where able to