Changes to Loop interface
Add close() method
Large code cleanup