fixed readNetlist() and made code cleaner