Removed some superfluous elements, added debug statements