Removed some coupling. Added documentation. Fixed variable naming.