Add main() and fiddled with imports and exceptions