added exception handling, simple validation