restructuring
migrate lib to pure js
fix js errors from port
porting complete