merged Devon's changes, made code less spogooter more OO