Added documentation, internalized irrelevant stuff