rewrote with prototypes
update readme