removed references to unused libraries from the cleanup, fixed the first/last lookup ordering