added invert method; polished shit up