Added documentation. Refined router functionality.