commented code, still needs to look pretified and condensed