rewritten; bug fixes

rewritten; now using nodejs and grunt; some other bug fixes