added doc strings and exceptions