adding docs, exception handling