Removed some unnecessary code in dense. Includes debugging comments.