adds tab support, error handling, cosmetics