Added documentation. Cleaned up design.