added readline, error codes