Improved parsing of imports; updated tests to handle empty import lists.