cleaned up code, made printing nicer