massive simplification. also put on npm