Added documentation, streamlined debugging