reorganized into a structure suitable for a gem
cleaned up things a bit