cleaned up, changed to Apache license, simplified