FINAL-VERSION

Fixed bugs, cleaned up code.