changed to GPL license
made function names more self-documenting
cleaned up old comments