Bit refactoring. Included readline support.