fixed formatting bug in markup
commented majority of code, added markup. Still work in progress.